#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main_0007()
{
    double a, b;
    cin >> a >> b;
    int k = a / b;
    cout <<  a - k *b;
    return 0;
}
